@echo off
title Cyan-Note Backend - Direct Java Compilation
echo.
echo ====================================
echo   Direct Java Compilation and Run
echo   (No Maven required)
echo ====================================
echo.

echo [INFO] Java Environment:
echo JAVA_HOME: %JAVA_HOME%
java -version
echo.

REM Create directories
if not exist "target\classes" mkdir target\classes

echo [INFO] Downloading required JAR files...
echo This is a simplified version for testing.
echo.

echo [INFO] Compiling Java sources...
echo.

REM Try to compile main application file only
echo Compiling CyanNoteApplication.java...
"%JAVA_HOME%\bin\javac" -d target\classes -cp "src\main\java" src\main\java\com\cyan\note\CyanNoteApplication.java

if %ERRORLEVEL% neq 0 (
    echo [ERROR] Compilation failed - missing dependencies
    echo.
    echo [SOLUTION] We need to use Maven or Gradle to download dependencies.
    echo Let's try a different approach...
    echo.
    pause
    exit /b 1
)

echo [SUCCESS] Compilation successful!
echo.
echo [INFO] Running application...
"%JAVA_HOME%\bin\java" -cp target\classes com.cyan.note.CyanNoteApplication

pause